package com.zh.mp.demo.modules.demo.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;


@Slf4j
@Service
public class ScheduleService {
    protected SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");

//    @Scheduled(fixedDelay = 2000)
//    public void scheduleTest1() throws InterruptedException {
//        log.info("scheduleTest1 Start.>>" + ft.format(new Date( )));
//    }

//    @Scheduled(fixedRate = 2000)
//    public void scheduleTest2() throws InterruptedException {
//        System.out.println("scheduleTest2 Start.>>" + ft.format(new Date( )));
//        Thread.sleep(6000);
//        System.out.println("scheduleTest2  End.>>" + ft.format(new Date( )));
//    }

//    @Scheduled(cron = "0 0/1 * * * ? ")
//    public void scheduleTest3() {
//        log.info("scheduleTest3 >>>" + ft.format(new Date( )));
//    }

//    @Scheduled(fixedRate = 2000, initialDelay = 1000)
//    public void scheduleTest4() throws InterruptedException {
//        log.info("scheduleTest4 fixedRate >>" + ft.format(new Date( )));
//    }
}
